package Vue;

import java.text.NumberFormat;

import javax.swing.JFormattedTextField;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;

/**
 * Un JTextField acceptant uniquement les Doubles.
 */
public class DoubleField extends JFormattedTextField {

	
	private static final long serialVersionUID = 1L;

	/**
	 * Instancie l'objet DoubleField
	 */
	public DoubleField(){
		
		NumberFormat format = NumberFormat.getNumberInstance();
		format.setGroupingUsed(false);
		format.setMaximumFractionDigits(6);
		format.setMaximumIntegerDigits(4);
		
		setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter(format)));
	
	}
	
}
